package org.ghost.parallel.demo.pool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.TimeUnit;

public enum ThreadPoolEnum {
    /**
     * CACHED_THREAD_POOL
     */
    CACHED_THREAD_POOL(1, new GhostThreadPoolExecutor(0, Integer.MAX_VALUE,
            60L, TimeUnit.SECONDS,
            new SynchronousQueue<Runnable>(), new GhostThreadFactory()));

    private int code;
    private ExecutorService executorService;

    ThreadPoolEnum(int code, ExecutorService executorService) {
        this.code = code;
        this.executorService = executorService;
    }

    public int getCode() {
        return code;
    }

    public ExecutorService getExecutorService() {
        return executorService;
    }
}
